package com.strangecard.web.controller.api;

import com.strangecard.common.annotation.IgnorePermissions;
import com.strangecard.common.core.domain.AjaxResult;
import com.strangecard.framework.jwt.utils.JwtUtil;
import com.strangecard.framework.jwt.utils.JwtUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/api")
public class LoginController extends ApiBaseController {

    @GetMapping("/login")
    @ResponseBody
    public AjaxResult login()
    {
        String token = JwtUtil.getToken("joe", JwtUtil.SECRET);
        return success(token);
    }

    @GetMapping("/login2")
    @ResponseBody
    public AjaxResult login2()
    {
        String username = JwtUtil.getSubject();
        return AjaxResult.success(username);
    }
}
